1. Technical Field
The present invention relates in general to data storage on disk storage media and in particular to error handling and recovery for disk storage media. Still more particularly, the present invention relates to relocating unreliable disk sectors when read errors are received while reading data.
2. Description of the Related Art
Accurate and prompt reporting of write errors or faults to a disk drive by device drivers, adapters, and/or disk drives when an attempted write to the hard disk drive is unsuccessful represents the ideal situation for data protection. Under these conditions, the system or user application has an opportunity to preserve the data by writing it elsewhere. However, the error may not be detected when the data is written, the error may not be properly reported if detected, or the data may be corrupted after being written to the disk media. The first two circumstances depend on the presence, reliability, and/or thoroughness of error detection, reporting and correction mechanisms for the disk drive, adapter, and device driver. The last circumstance results from failure of the disk media for any one of a number of reasons such as head damage to the disk media, stray magnetic fields, or contaminants finding their way into the disk drive.
Virtually all contemporary disk drives can detect and report a bad data read from the disk media, typically through CRC errors. When CRC errors are returned from reading a sector, often the read may be retried successfully, and most file systems simply continue if the data was successfully recovered from the sector.
A sector for which reads must be retried multiple times is likely to be "failing," or in the process of becoming unrecoverable. Once a sector becomes unrecoverable, disk drives will normally perform relocation of the bad sector to a reserved replacement sector on the drive. However, sectors are generally relocated only after they have become unrecoverable, and typically a sector which may be successfully read is deemed good regardless of the number of attempts required to read the data. This may result in loss of data since the sector was not relocated prior to the sector becoming unrecoverable--that is, prior to the data becoming unreadable and therefore "lost."
It would be desirable, therefore, to provide a mechanism for detecting and relocating failing or unreliable disk sectors prior to complete loss of data within the sector.